package com.ruoyi.web.controller.laiqianba.product;

import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.product.service.IProductDataUnionCountInfoService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.db.domain.ProductDataUnionCountInfo;
import com.ruoyi.web.wrapper.ProductDataUnionCountInfoWrapper;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 联登统计Controller
 * 
 * @author ruoyi
 * @date 2025-07-18
 */
@RestController
@RequestMapping("/product/ProductDataUnionCountInfo")
public class ProductDataUnionCountInfoController extends BaseController
{
    @Autowired
    private IProductDataUnionCountInfoService productDataUnionCountInfoService;

    /**
     * 查询联登统计列表
     */
    @PreAuthorize("@ss.hasPermi('product:ProductDataUnionCountInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(ProductDataUnionCountInfo productDataUnionCountInfo)
    {
        startPage();
        List<Map<String, Object>> list = productDataUnionCountInfoService.selectProductDataUnionCountInfoMapList(productDataUnionCountInfo);
        list = new ProductDataUnionCountInfoWrapper(list).wrap();
        return getDataTable(list);
    }

    /**
     * 导出联登统计列表
     */
    @PreAuthorize("@ss.hasPermi('product:ProductDataUnionCountInfo:export')")
    @Log(title = "联登统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProductDataUnionCountInfo productDataUnionCountInfo)
    {
        List<ProductDataUnionCountInfo> list = productDataUnionCountInfoService.selectProductDataUnionCountInfoList(productDataUnionCountInfo);
        ExcelUtil<ProductDataUnionCountInfo> util = new ExcelUtil<ProductDataUnionCountInfo>(ProductDataUnionCountInfo.class);
        util.exportExcel(response, list, "联登统计数据");
    }

    /**
     * 获取联登统计详细信息
     */
    @PreAuthorize("@ss.hasPermi('product:ProductDataUnionCountInfo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(productDataUnionCountInfoService.selectProductDataUnionCountInfoById(id));
    }

    /**
     * 新增联登统计
     */
    @PreAuthorize("@ss.hasPermi('product:ProductDataUnionCountInfo:add')")
    @Log(title = "联登统计", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProductDataUnionCountInfo productDataUnionCountInfo)
    {
        return toAjax(productDataUnionCountInfoService.insertProductDataUnionCountInfo(productDataUnionCountInfo));
    }

    /**
     * 修改联登统计
     */
    @PreAuthorize("@ss.hasPermi('product:ProductDataUnionCountInfo:edit')")
    @Log(title = "联登统计", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProductDataUnionCountInfo productDataUnionCountInfo)
    {
        return toAjax(productDataUnionCountInfoService.updateProductDataUnionCountInfo(productDataUnionCountInfo));
    }

    /**
     * 删除联登统计
     */
    @PreAuthorize("@ss.hasPermi('product:ProductDataUnionCountInfo:remove')")
    @Log(title = "联登统计", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(productDataUnionCountInfoService.deleteProductDataUnionCountInfoByIds(ids));
    }
}
